<template>
    <div class="customer vipCard">

        <el-row style="margin-top: 15px;padding: 20px 0;">
            <el-col :span="24">
                <el-button  @click="goBack()" type="primary" >返回</el-button>
                <el-tabs v-model="activeName" @tab-click="handleClick" style="margin-top: 20px;">
                    <el-tab-pane :label="'服务商城'" name="1"></el-tab-pane>
                    <el-tab-pane :label="'代金券'" name="2"></el-tab-pane>
					<el-tab-pane :label="'会员卡'" name="3"></el-tab-pane>
                 </el-tabs>
            </el-col>
        </el-row>

        <el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="100px" v-show="activeName==1">
            <el-form-item label="按客房名称:">
                <el-input v-model="formInline.roomName" style="width: 150px;" :maxlength="50"></el-input>
            </el-form-item>
            <el-form-item label="按状态：">
                <el-select v-model="formInline.roomState" style="width: 120px;" >
                    <el-option label="全部" value=""></el-option>
                    <el-option :label="item.text" :value="item.value" v-for="item in statList"></el-option>
                </el-select>
            </el-form-item>
            <el-button type="primary" @click="fetchData(1)">查询</el-button>
        
        </el-form>
        <el-table
                :data="pageInfo.dtos"
                v-loading="table_loading"
                element-table_loading-text="加载中"
                stripe
                @sort-change='order'
                v-show="activeName==1"
                style="width: 100%">
             <el-table-column
                    width="80"
                    type="index"
                    label="序号">
            </el-table-column>
            <el-table-column
                    label="图片">
                    <template scope="scope">
                        <img class="avatar" :src="scope.row.roomImg" style="width: 55px;height: 55px;border-radius: 0;">
                    </template>
            </el-table-column>
            <el-table-column
                    prop="roomName"
                    label="客房名称">
            </el-table-column>
            <el-table-column
                    label="排序值"
                    prop="room_Sort"
                    width="115"
                    sortable='custom'>
                    <template scope="scope">
                        <span>{{ scope.row.roomSort }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="stt_Price"
                    sortable='custom'
                    label="周日-周四价格">
                    <template scope="scope">
                        <span>{{ scope.row.sttPrice }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="fts_Price"
                    sortable='custom'
                    label="周五-周六价格">
                    <template scope="scope">
                        <span>{{ scope.row.ftsPrice }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="hotel_Room_Ratio"
                    label="补贴比例">
                    <template scope="scope">
                        <span>{{ scope.row.roomDefRatio*100 }}%</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="normalState"
                    label="状态">
                    <template scope="scope">
                        <span>{{statList[scope.row.roomState].text}}</span>
                    </template>
            </el-table-column>
            <el-table-column label="操作" width="140">
                <template scope="scope">
                    <el-button type="primary" size="small" @click="hotelDetail(scope.row.roomId)">编辑</el-button>
                    <el-button type="danger" size="small"  v-if="scope.row.roomState==1"
                               @click="handleDelete(scope.row,'禁用')">禁用
                    </el-button>
                    <el-button type="success" size="small" v-else
                               @click="handleDelete(scope.row,'启用')">启用
                    </el-button> 
                </template>
            </el-table-column>
        </el-table>
        <div class="paginate" v-show="activeName==1">
            <el-pagination
                    @current-change="handleCurrentChange"
                    :current-page="pageInfo.pageNum"
                    :page-size="pageInfo.pageSize"
                    layout="total, prev, pager, next, jumper"
                    :total="pageInfo.count"
                    >
            </el-pagination>
        </div>

        <!--代金券table-->
        <el-form :inline="true" :model="formInline2" class="demo-form-inline" label-width="120px" v-show="activeName==2">
            <el-form-item label="按代金券名称:">
                <el-input v-model="formInline2.voucherName" style="width: 150px;" :maxlength="50"></el-input>
            </el-form-item>
            <el-form-item label="按状态：">
                <el-select v-model="formInline2.voucherStat" style="width: 120px;" >
                    <el-option label="全部" value=""></el-option>
                    <el-option :label="item.text" :value="item.value" v-for="item in statList"></el-option>
                </el-select>
            </el-form-item>
            <el-button type="primary" @click="fetchData2(1)">查询</el-button>
        
        </el-form>
        <el-table
                :data="pageInfo2.dtos"
                v-loading="table_loading"
                element-table_loading-text="加载中"
                stripe
                @sort-change='order2'
                v-show="activeName==2"
                style="width: 100%">
            <el-table-column
                    type="index"
                    width="80"
                    label="序号">
            </el-table-column>
            <el-table-column
                    label="封面">
                    <template scope="scope">
                        <img class="avatar" :src="scope.row.voucherCover" style="width: 55px;height: 55px;border-radius: 0;">
                    </template>
            </el-table-column>
            <el-table-column
                    prop="voucherName"
                    label="代金券名称">
            </el-table-column>
            <el-table-column
                    sortable='custom'
                    prop="voucher_Amt"
                    label="价格">
                    <template scope="scope">
                        <span>{{ scope.row.voucherAmt }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="voucherSunNum"
                    label="销量">
            </el-table-column>
            <el-table-column
                    prop="voucherNum"
                    label="库存">
            </el-table-column>
            <el-table-column
                    sortable='custom'
                    label="有效期">
                    <template scope="scope">
                        <span>{{ scope.row.voucherStartTime }}-{{ scope.row.voucherEndTime }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="normalState"
                    label="状态">
                    <template scope="scope">
                        <span>{{statList[scope.row.voucherStat].text}}</span>
                    </template>
            </el-table-column>
            <el-table-column label="操作" width="140">
                <template scope="scope">
                    <el-button type="primary" size="small" @click="voucherDetail(scope.row.voucherId)">查看</el-button>
                    <el-button type="danger" size="small"  v-if="scope.row.voucherStat==1"
                               @click="handleDelete2(scope.row,'禁用')">禁用
                    </el-button>
                    <el-button type="success" size="small" v-else
                               @click="handleDelete2(scope.row,'启用')">启用
                    </el-button> 
                </template>
            </el-table-column>
        </el-table>
        <div class="paginate" v-show="activeName==2">
            <el-pagination
                    @current-change="handleCurrentChange"
                    :current-page="pageInfo2.pageNum"
                    :page-size="pageInfo2.pageSize"
                    layout="total, prev, pager, next, jumper"
                    :total="pageInfo2.count"
                    >
            </el-pagination>
        </div>
		
		<!--会员卡table-->
		<el-row style="position: relative;" v-show="activeName==3">
<!-- 			<el-col :span="24">
		
				<el-button type="primary" @click="$router.push('/merchant/merchant_list')">返回
				</el-button>
			</el-col> -->
		<el-form :inline="true" :model="formInline3" class="demo-form-inline" label-width="120px" >
		    <el-form-item label="会员卡状态：">
		        <el-select v-model="formInline3.voucherStat" style="width: 120px;" >
		            <el-option label="全部" value=""></el-option>
		            <el-option :label="item.text" :value="item.value" v-for="item in vipCardList"></el-option>
		        </el-select>
		    </el-form-item>
		    <el-button type="primary" @click="fetchData3(1)">查询</el-button>
			<el-button  type="primary" @click="findCardList()">会员卡名单</el-button>
			<!-- <el-button type="primary" @click="findPayCardList()">会员卡购买记录</el-button> -->
		</el-form>
		
		</el-row>
		
		<el-table
		        :data="pageInfo3.lists"
		        v-loading="table_loading"
		        element-table_loading-text="加载中"
		        stripe
		        v-show="activeName==3"
		        style="width: 100%">
		    <el-table-column
		            type="index"
		            width="80"
		            label="序号">
		    </el-table-column>

		    <el-table-column
		            prop="voucherName"
		            label="卡片名称">
		    </el-table-column>
			<el-table-column
			        label="会员卡封面">
			        <template scope="scope">
			            <img class="avatar" :src="scope.row.voucherCover" style="width: 100px;border-radius: 5px;margin: 5px 0;">
			        </template>
			</el-table-column>
		    <el-table-column
		            prop="balance"
		            label="卡片面值(元)">
		    </el-table-column>
		    <el-table-column
		            prop="voucherAmt"
		            label="卡片售价(元)">
		    </el-table-column>
		    <el-table-column
		            prop="voucherNum"
		            label="库存数量">
		    </el-table-column>
			<el-table-column
			prop="voucherSunNum"
			        label="销量">
			</el-table-column>
			<el-table-column
			        label="补贴比例">
					<template scope="scope">
					   	<span>{{ scope.row.rate*100 }}%</span>
					</template>
			</el-table-column>
		    
		    <el-table-column
		            prop="normalState"
		            label="状态">
		            <template scope="scope">
		                <span>{{vipCardList[scope.row.voucherStat].text}}</span>
		            </template>
		    </el-table-column>
		    <el-table-column label="操作" width="140">
		        <template scope="scope">
		            <el-button type="primary" size="small" @click="showCardDiog(scope.row)">查看</el-button>
		            <el-button type="danger" size="small"  v-if="scope.row.voucherStat==1"
		                       @click="handleDelete3(scope.row,'下架')">下架
		            </el-button>
		            <el-button type="success" size="small" v-else
		                       @click="handleDelete3(scope.row,'上架')">上架
		            </el-button> 
		        </template>
		    </el-table-column>
		</el-table>
		<div class="paginate" v-show="activeName==3">
		    <el-pagination
		            @current-change="handleCurrentChange"
		            :current-page="pageInfo3.pageNum"
		            :page-size="pageInfo3.pageSize"
		            layout="total, prev, pager, next, jumper"
		            :total="pageInfo3.count"
		            >
		    </el-pagination>
		</div>
		<!-- 会员卡购买记录 -->
		<div class="cardDialeg">
			<el-dialog title="会员卡名单" :visible.sync="dialogVisiblePayHistory" :before-close="handleClose" center="true">
				<div style="padding: 0 20px;">
					<el-table :data="pageInfoPay.dtos" v-loading="tableCard_loading" element-table_loading-text="加载中" style="width: 100%">
						<el-table-column
						        prop="voucherName"
						        label="卡片名称">
						</el-table-column>
						<el-table-column
						        label="会员卡封面">
						        <template scope="scope">
						            <img class="avatar" :src="scope.row.voucherCover" style="width: 100px;border-radius: 5px;margin: 5px 0;">
						        </template>
						</el-table-column>
						<el-table-column
						        prop="voucherAmt"
						        label="卡片售价(元)">
						</el-table-column>
						<el-table-column
						        prop="voucherNum"
						        label="库存数量">
						</el-table-column>
						<el-table-column
						prop="voucherSunNum"
						        label="销量">
						</el-table-column>
						
					</el-table>
					<div class="paginate">
						<el-pagination @current-change="handleCurrentChangePay" :current-page="pageInfoPay.pageNum" :page-size="pageInfoPay.pageSize"
						 layout="total, prev, pager, next, jumper" :total="pageInfoPay.count">
						</el-pagination>
					</div>
				</div>
			</el-dialog>
		</div>
		<el-dialog
		  title="查看会员卡"
		  :visible.sync="dialogVisible"
		  :before-close="handleClose"
		  :width="widthCard"
		  center="true">
		  <el-tabs v-model="activeCardName" @tab-click="handleClickCard" style="margin-top: 20px;">
		      <el-tab-pane :label="'会员卡信息'" name="1"></el-tab-pane>
		      <el-tab-pane :label="'其他信息'" name="2"></el-tab-pane>
		   </el-tabs>
		   <div style="padding: 0 40px 0 20px;">
			   <el-form  :model="formInlineCard"  class="demo-form-inline" label-width="120px" v-show="activeCardName==1">
							<el-form-item label="会员卡名称：">
							   <el-input v-model="formInlineCard.voucherName"></el-input>
							</el-form-item>
			   				<el-form-item label="会员卡封面：">
			   				  <div >
			   				  	<we-ui-uploads :images="formInlineCard.voucherCover" :maxCount="1" :maxSize="1024*1024" @uploading="uploading4"></we-ui-uploads>
			   				  </div>
			   				</el-form-item>
							<el-form-item label="会员卡logo：">
							  <div >
							  	<we-ui-uploads :images="formInlineCard.logo" :maxCount="1" :maxSize="1024*1024" @uploading="uploading4"></we-ui-uploads>
							  </div>
							</el-form-item>
			   				<el-form-item label="卡片面值：">
			   				   <el-input v-model="formInlineCard.balance" ></el-input>
			   				</el-form-item>
			   				<el-form-item label="卡片售价：">
			   				   <el-input v-model="formInlineCard.voucherAmt" ></el-input>
			   				</el-form-item>
			   				<el-form-item label="有效日期：">
								<el-input v-model="endDaTE" readonly></el-input>
			   				</el-form-item>
			   				<el-form-item label="库存数量：">
			   				   <el-input v-model="formInlineCard.voucherNum" ></el-input>
			   				</el-form-item>
			   				<el-form-item label="特权说明：">
			   				    <el-input v-model="formInlineCard.voucherRemark" :maxlength="120"  type="textarea" :rows="3"></el-input>
			   				</el-form-item>
			   				<el-form-item label="使用须知：">
			   				   <el-input v-model="formInlineCard.voucherUseRule" :maxlength="120"  type="textarea" :rows="3"></el-input>
			   				</el-form-item>
			   </el-form>
			   
			   <el-form  :model="formInlineCard"  class="demo-form-inline" label-width="120px" v-show="activeCardName==2">
			   							<el-form-item label="创建时间：">
			   							   <el-input v-model="formInlineCard.creTime" readonly></el-input>
			   							</el-form-item>
			   				<el-form-item label="销量：">
			   				   <el-input v-model="formInlineCard.voucherSunNum" readonly></el-input>
			   				</el-form-item>
			   				<el-form-item label="会员卡状态：">
			   				   <el-select v-model="formInlineCard.voucherStat" style="width: 192px;" >
			   				       <el-option label="全部" value=""></el-option>
			   				       <el-option :label="item.text" :value="item.value" v-for="item in vipCardList"></el-option>
			   				   </el-select>
			   				</el-form-item>
			   				<el-form-item label="补贴比例：">
			   				   <el-select v-model="formInlineCard.rate" style="width: 192px;margin-right: 30px;">
			   				       <el-option :label="item.text" :value="item.value" v-for="item in scalePublicData"></el-option>
			   				   </el-select>
			   				</el-form-item>
			   </el-form>
		   </div>
		  <span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="cardSubmit()">确 定</el-button>
				<el-button @click="dialogVisible = false">取 消</el-button>
		  </span>
		</el-dialog>
		
		<div class="cardDialeg">
			<el-dialog
			  title="会员卡名单"
			  :visible.sync="dialogVisibleAll"
			  :before-close="handleClose"
			  center="true">
			   <div style="padding: 0 20px;">
				<el-table
				        :data="pageInfo4.dtos"
				        v-loading="tableCard_loading"
				        element-table_loading-text="加载中"
				        style="width: 100%">
				    <el-table-column
				            label="用户Id"
							prop="userId">
				    </el-table-column>
				    <el-table-column
				            prop="name"
				            label="用户名">
				    </el-table-column>
				    <el-table-column
				            prop="phone"
				            label="手机号">
				    </el-table-column>
					<el-table-column
					        prop="voucherId"
					        label="会员卡号">
					</el-table-column>
				    <el-table-column
				            prop="voucherName"
				            label="会员卡名称">
				    </el-table-column>
				    <el-table-column
				            prop="userName"
				            label="会员卡绑定姓名">
				    </el-table-column>
				    <el-table-column
				            prop='userPhone'
				            label="会员卡绑定手机号">
				    </el-table-column>
				    <el-table-column
				            prop="balance"
				            label="会员卡余额">
				    </el-table-column>
				</el-table>
				<div class="paginate">
				    <el-pagination
				            @current-change="handleCurrentChangeCard"
				            :current-page="pageInfo4.pageNum"
				            :page-size="pageInfo4.pageSize"
				            layout="total, prev, pager, next, jumper"
				            :total="pageInfo4.count"
				            >
				    </el-pagination>
				</div>
			   </div>
			</el-dialog>
		</div>
    
	</div>

</template>
<style>
.vipCard .el-tabs__item{
     font-size:18px !important;
	color: #222222;
}
.vipCard .el-tabs__header{
  border-bottom:none;
}
.vipCard .el-dialog__header{
	text-align: center;
	background-color: #f4f5f6;
	padding: 20px;
}
.vipCard .el-dialog__body{
	padding: 0;
}
.vipCard .el-dialog--small{
	width: 30%;
}
.cardDialeg .el-dialog--small{
	width: 70%;
}
.vipCard .el-form-item {
	margin-bottom: 10px;
}
.weui-uploader__files img{
	width: 100px!important;
	height: auto!important;
}
</style>
<script>
    export default {
        data() {
            return {
				widthCard: '30%',
                title: '用户列表',
				endDaTE: '长期有效',
				loading: false,
                table_loading: false,
				tableCard_loading: false,
				dialogVisible: false,
				dialogVisibleAll: false,
                pageInfo: {
                    pageNum: 1,
                    pageSize: 1,
                    count: 1,
                    dtos:[]
                },
                formInline: {
                    pageNo:1,
                    pageSize: 10,
                    sort:'CRE_TIME',
                    desc:'DESC',
                    roomState:'',
                    roomName:'',
                    storeId:''
                },
                formInline2: {
                    pageNum:1,
                    sort:'VOUCHER_AMT',
                    desc:'DESC',
                    pageSize:10,
                    storeId:'',
                    voucherType:'1',
                    voucherName:'',
                    voucherStat:'',
                    storeId:''
                },
                pageInfo2: {
                    pageNum: 1,
                    pageSize: 1,
                    count: 1,
                    dtos:[]
                },
				formInline3: {
				    pageNum:1,
				    sort:'VOUCHER_AMT',
					voucherType:'3',
				    desc:'DESC',
				    pageSize:10,
				    type:'3',
				    storeId:''
				},
				pageInfo3: {
				    pageNum: 1,
				    pageSize: 1,
				    count: 1,
				    dtos:[]
				},
				formInline4: {
				    pageNum:1,
				    sort:'VOUCHER_AMT',
				    desc:'DESC',
				    pageSize:10,
				    storeId:''
				},
				formInlineCard: {
				},
				pageInfo4: {
				    pageNum: 1,
				    pageSize: 1,
				    count: 1,
				    dtos:[]
				},
				proportion: [{
						text: '2%',
						value: 0.02
					}, {
						text: '4%',
						value: 0.04
					}, {
						text: '6%',
						value: 0.06
					},
					{
						text: '8%',
						value: 0.08
					}
				],
                formLabelWidth: '120px',
                loading:false,
                dialogVisible:false,
                activeName: '1',
				activeCardName: '1',
                sortList:[],
                secondList:[],
                showSort:false,
                storeId:'',
                statList:[{ text: '商家禁用', value: '0' },{ text: '已启用', value: '1' },{ text: '平台禁用', value: '2' }],
				vipCardList: [
					{ text: '已下架', value: '0' },
					{ text: '出售中', value: '1' },
					{ text: '已失效', value: '2' }
				],
				dialogVisiblePayHistory: false,
				formInlinePay: {
					pageNum: 1,
					sort: 'VOUCHER_AMT',
					desc: 'DESC',
					pageSize: 10,
					storeId: '',
					voucherType: '3',
					voucherName: '',
					voucherStat: '',
					storeId: ''
				},
				pageInfoPay: {
					pageNum: 1,
					pageSize: 1,
					count: 1,
					dtos: []
				},

            }
        },
        created(){
            this.formInline.storeId=this.$route.params.id
            this.formInline2.storeId=this.$route.params.id
			this.formInline3.storeId=this.$route.params.id
			this.formInline4.storeId=this.$route.params.id
			this.formInlinePay.storeId = this.$route.params.id
            this.storeId=this.$route.params.id
            this.selectSort()
            this.fetchData(this.pageInfo.pageNum);
        },
        activated() {
            
        },
        methods: {
            fetchData (page = 1) {
                 this.table_loading = true;
                this.pageInfo.pageNum = page
                this.formInline.pageNum = this.pageInfo.pageNum
                this.dataApi.ajax('selectPageStoreHotelRoom',this.formInline, res => {
                    this.table_loading = false;
                    if (res.responseType === 'S') {
                        this.pageInfo = res
                    }
                });

            },
             fetchData2 (page = 1) {
                this.table_loading = true;
                this.pageInfo2.pageNum = page
                this.formInline2.pageNum = this.pageInfo2.pageNum
                this.dataApi.ajax('selectPagePayStoreVoucher',this.formInline2, res => {
                    this.table_loading = false;
                    if (res.responseType === 'S'){
                        this.pageInfo2 = res
                    }
                });

            },
			fetchData3 (page = 1) {
			    this.table_loading = true;
			    this.pageInfo3.pageNum = page
			    this.formInline3.pageNum = this.pageInfo3.pageNum
			    this.dataApi.ajax('selectStoreCardByPage',this.formInline3, res => {
			        this.table_loading = false;
			        if (res.responseType === 'S'){
			            this.pageInfo3 = res
			        }
			    });
			
			},
			findCardList () {
				this.fetchData4(1)
			},
			fetchData4 (page = 1) {
			    this.tableCard_loading = true;
			    this.pageInfo4.pageNum = page
			    this.formInline4.pageNum = this.pageInfo4.pageNum
			    this.dataApi.ajax('storeCardUserList',this.formInline4, res => {
			        this.tableCard_loading = false;
					console.log(res)
			        if (res.responseType === 'S'){
			            this.pageInfo4 = res
						this.dialogVisibleAll = true
			        }
			    });
			
			},
			showCardDiog (data) {
				this.dialogVisible = true
				this.formInlineCard = JSON.parse(JSON.stringify(data))
				if (this.formInlineCard.voucherCover != ''){
					let formInlineCardstr = this.formInlineCard.voucherCover
					let formInlineCardarr = formInlineCardstr.split(',')
					this.formInlineCard.voucherCover = formInlineCardarr
				} else{
					this.formInlineCard.voucherCover = []
				}
				if (this.formInlineCard.logo != ''){
					let logostr = this.formInlineCard.logo
					let logoarr = logostr.split(',')
					this.formInlineCard.logo = logoarr
				} else{
					this.formInlineCard.logo = []
				}
			},
			handleClose() {
			    this.dialogVisible = false
				this.dialogVisibleAll = false
				this.dialogVisiblePayHistory = false
			},
            changeType(){
                this.formInline.phone=''
                this.formInline.realName=''
            },
            handleCurrentChange(val) {
               
                if (this.activeName=='1') {
                   this.fetchData(val)
                }
                if (this.activeName=='2') {
                   this.fetchData2(val)
                }    
				if (this.activeName=='3') {
				   this.fetchData3(val)
				} 
            },
			handleCurrentChangeCard (val) {
				this.fetchData4(val)
			},
            hotelDetail(id){
                this.$router.push('/merchant/hotel_detail/' + id)
            },
            voucherDetail(id){
                this.$router.push('/merchant/voucher_detail/' + id)
            },
            order(column){
                if (!column.order) {
                    return;
                }
                 if (column.order=='ascending') {
                     this.formInline.desc='ASC'
                }else{
                    this.formInline.desc='DESC'
                }
                this.formInline.sort=column.prop.toUpperCase()
                this.fetchData(this.pageInfo.pageNum)
            },
            order2(column){
                if (!column.order) {
                    return;
                }
                 if (column.order=='ascending') {
                     this.formInline2.desc='ASC'
                }else{
                    this.formInline2.desc='DESC'
                }
                this.formInline2.sort=column.prop.toUpperCase()
                this.fetchData2(this.pageInfo2.pageNum)
            },
            check(item){
               this.$router.push('/manor/manor_deal/'+item.cityCode+'?cityName='+item.cityName)
            },
            handleClick(tab, event) {
                if (this.activeName=='1') {
                   this.fetchData(1)
                }
                if (this.activeName=='2') {
                   this.fetchData2(1)
                }
				if (this.activeName=='3') {
				   this.fetchData3(1)
				}

            },
			handleClickCard() {
				
			},
            selectSort(){
                this.dataApi.ajax('selectGoodCate',{cateState:'1',storeId:this.storeId}, res => {
                    //console.log(res)
                    if (res.responseType === 'S') {
                       this.sortList = res.dtos
                    }
                });

            },
            selectSort2(){
                this.formInline.goodTwoCate = ''
                this.dataApi.ajax('selectGoodCate', {cateId:this.formInline.goodOneCate,cateState:'1',storeId:this.storeId}, res => {
                    //console.log(res)
                    if (res.responseType === 'S') {
                        this.secondList = res.dtos
                    }
                });

            },
             handleDelete(item,type){
                 this.$confirm('确认'+type+'?', '提示', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(() => {
                      this.dataApi.ajax('enableStoreHotelRoom',{roomId:item.roomId}, res => {
                            if (res.responseType === 'S') {
                                this.$message({
                                    type: 'success',
                                    message: type+'成功!'
                                });
                                this.fetchData(this.pageInfo.pageNum)
                            }
                        });
                    }).catch(() => {
                              
                    });
            },
             handleDelete2(item,type){
                var state=''
                state=item.voucherStat==1? 2:1
                this.$confirm('确认'+type+'?', '提示', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(() => {
                      this.dataApi.ajax('editPayStoreVoucher',{voucherStat:state,voucherId:item.voucherId}, res => {
                            if (res.responseType === 'S') {
                                this.$message({
                                    type: 'success',
                                    message: type+'成功!'
                                });
                                this.fetchData2(this.pageInfo2.pageNum)
                            }
                        });
                    }).catch(() => {
                              
                    });
            },
			handleDelete3(item,type){
			    var state=''
			    state=item.voucherStat==1? 2:1
			    this.$confirm('确认'+type+'?', '提示', {
			          confirmButtonText: '确定',
			          cancelButtonText: '取消',
			          type: 'warning'
			        }).then(() => {
			          this.dataApi.ajax('editPayStoreCard',{voucherStat:state,voucherId:item.voucherId}, res => {
			                if (res.responseType === 'S') {
			                    this.$message({
			                        type: 'success',
			                        message: type+'成功!'
			                    });
			                    this.fetchData3(this.pageInfo3.pageNum)
			                }
			            });
			        }).catch(() => {
			                  
			        });
			},
			uploading4(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading5(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			cardSubmit () {
				if (this.formInlineCard.voucherCover.length < 1 ) {
					this.showMsg('请上传卡片封面', 'warning')
					return false;
				}
				let data = JSON.parse(JSON.stringify(this.formInlineCard))
				var arr2 = data.voucherCover
				var str2 = arr2.join(',');
				data.voucherCover = str2
				var arr3 = data.logo
				var str3 = arr3.join(',');
				data.logo = str3
				this.dataApi.ajax('editPayStoreCard',data, res => {
				    if (res.responseType === 'S'){
						this.$message({
						    type: 'success',
						    message: '编辑成功!'
						});
						this.formInlineCard = {
							voucherName: '',
							voucherCover: [],
							logo: [],
							balance: '',
							voucherAmt: '',
							voucherNum: '',
							voucherRemark: '',
							voucherUseRule: '',
							voucherStat: '1',
							storeId: '',
							voucherType: '3',
							rate: '0.08'
						}
						this.dialogVisible = false
						this.fetchData3(1)
				    }
				});
			},
			findPayCardList() {
				this.fetchDataPay(1)
				this.dialogVisiblePayHistory = true
				console.log('会员卡购买记录')
			},
			fetchDataPay(page = 1) {
				this.table_loading = true;
				this.pageInfoPay.pageNum = page
				this.formInlinePay.pageNum = this.pageInfoPay.pageNum
				this.dataApi.ajax('selectPagePayStoreVoucher', this.formInlinePay, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						this.pageInfoPay = res
						console.log(res)
					}
				});
			
			},
			handleCurrentChangePay(val) {
				this.fetchDataPay(val)
			},

        }
    }
</script>
